<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Sets the image ticks-per-second</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="imagick.setimagescene.html">Imagick::setImageScene</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="imagick.setimagetype.html">Imagick::setImageType</a></div>
 <div class="up"><a href="class.imagick.html">Imagick</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="imagick.setimagetickspersecond" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">Imagick::setImageTicksPerSecond</h1>
  <p class="verinfo">(PECL imagick 2.0.0)</p><p class="refpurpose"><span class="refname">Imagick::setImageTicksPerSecond</span> &mdash; <span class="dc-title">Sets the image ticks-per-second</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-imagick.setimagetickspersecond-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="type">bool</span> <span class="methodname"><strong>Imagick::setImageTicksPerSecond</strong></span>
    ( <span class="methodparam"><span class="type">int</span> <code class="parameter">$ticks_per_second</code></span>
   )</div>

  <p class="para rdfs-comment">
   Adjust the amount of time that a frame of an animated image is displayed for.
  </p>
  <blockquote class="note"><p><strong class="note">Note</strong>: 
   <p class="para">
    For animated GIFs, this function does not change the number of &#039;image ticks&#039;
    per second, which is always defined as 100. Instead it adjusts the amount of
    time that the frame is displayed for to simulate the change in &#039;ticks per
    second&#039;.
   </p>
   <p class="para">
    For example, for an animated GIF where each frame is displayed for 20 ticks
    (1/5 of a second) when this method is called on each frame of that image
    with an argument of <em>50</em> the frames are adjusted to be
    displayed for 40 ticks (2/5 of a second) and the animation will play at half
    the original speed.
   </p>
  </p></blockquote>
 </div>


 <div class="refsect1 parameters" id="refsect1-imagick.setimagetickspersecond-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>

    
     <dt>
<em><code class="parameter">ticks_per_second</code></em></dt>

     <dd>

      <p class="para">
       The duration for which an image should be displayed expressed in ticks
       per second.
      </p>
     </dd>

    
   </dl>

  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-imagick.setimagetickspersecond-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   成功时返回 <strong><code>TRUE</code></strong>。
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-imagick.setimagetickspersecond-examples">
    <h3 class="title">范例</h3>
  <p class="para">
   <div class="example" id="example-3250">
    <p><strong>Example #1 Modify animated Gif with <span class="function"><strong>Imagick::setImageTicksPerSecond()</strong></span></strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /><br /></span><span style="color: #FF8000">//&nbsp;Modify&nbsp;an&nbsp;animated&nbsp;gif&nbsp;so&nbsp;the&nbsp;first&nbsp;half&nbsp;of&nbsp;the&nbsp;gif&nbsp;is&nbsp;played&nbsp;at&nbsp;half&nbsp;the<br />//&nbsp;speed&nbsp;it&nbsp;currently&nbsp;is,&nbsp;and&nbsp;the&nbsp;second&nbsp;half&nbsp;to&nbsp;be&nbsp;played&nbsp;at&nbsp;double&nbsp;the&nbsp;speed<br />//&nbsp;it&nbsp;currently&nbsp;is<br /><br /></span><span style="color: #0000BB">$imagick&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">Imagick</span><span style="color: #007700">(</span><span style="color: #0000BB">realpath</span><span style="color: #007700">(</span><span style="color: #DD0000">"Test.gif"</span><span style="color: #007700">));<br /></span><span style="color: #0000BB">$imagick&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$imagick</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">coalesceImages</span><span style="color: #007700">();<br /><br /></span><span style="color: #0000BB">$totalFrames&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$imagick</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getNumberImages</span><span style="color: #007700">();<br /><br /></span><span style="color: #0000BB">$frameCount&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">;<br /><br />foreach&nbsp;(</span><span style="color: #0000BB">$imagick&nbsp;</span><span style="color: #007700">as&nbsp;</span><span style="color: #0000BB">$frame</span><span style="color: #007700">)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$imagick</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">setImageTicksPerSecond</span><span style="color: #007700">(</span><span style="color: #0000BB">50</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(</span><span style="color: #0000BB">$frameCount&nbsp;</span><span style="color: #007700">&lt;&nbsp;(</span><span style="color: #0000BB">$totalFrames&nbsp;</span><span style="color: #007700">/&nbsp;</span><span style="color: #0000BB">2</span><span style="color: #007700">))&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #FF8000">//&nbsp;Modify&nbsp;the&nbsp;frame&nbsp;to&nbsp;be&nbsp;displayed&nbsp;for&nbsp;twice&nbsp;as&nbsp;long&nbsp;as&nbsp;it&nbsp;currently&nbsp;is<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$imagick</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">setImageTicksPerSecond</span><span style="color: #007700">(</span><span style="color: #0000BB">50</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;else&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #FF8000">//&nbsp;Modify&nbsp;the&nbsp;frame&nbsp;to&nbsp;be&nbsp;displayed&nbsp;for&nbsp;half&nbsp;as&nbsp;long&nbsp;as&nbsp;it&nbsp;currently&nbsp;is<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$imagick</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">setImageTicksPerSecond</span><span style="color: #007700">(</span><span style="color: #0000BB">200</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$frameCount</span><span style="color: #007700">++;<br />}<br /><br /></span><span style="color: #0000BB">$imagick&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$imagick</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">deconstructImages</span><span style="color: #007700">();<br /><br /></span><span style="color: #0000BB">$imagick</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">writeImages</span><span style="color: #007700">(</span><span style="color: #DD0000">"/path/to/save/output.gif"</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">true</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
    </div>

   </div>
  </p>
 </div>


</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="imagick.setimagescene.html">Imagick::setImageScene</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="imagick.setimagetype.html">Imagick::setImageType</a></div>
 <div class="up"><a href="class.imagick.html">Imagick</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>
